package com.example.testfragment;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager2.adapter.FragmentStateAdapter;

public class MyFragmentStateAdapter extends FragmentStateAdapter {
    public MyFragmentStateAdapter(FragmentActivity fragmentActivity)
    {
        super(fragmentActivity);
    }

    public Fragment createFragment (int position) {
        switch (position) {
            case 0:return new SimpleFragment();
            case 1:return new SimpleFragment2();
        }
        return  null;
    }

    @Override
    public int getItemCount() {
        return 2;
    }
}
